package cn.kgc.service.impl;

import cn.kgc.entity.Users;
import cn.kgc.mapper.UsersMapper;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 帅气逼人程序员
 * @version 1.0
 * @date 2023/3/2 - 19:21
 */
@Service
public class UsersServiceImpl implements UserDetailsService {
    @Resource
    private UsersMapper usersMapper;

    @Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
        System.out.println("userName是"+userName);
        Users users=usersMapper.getUserByName(userName);
        System.out.println("查出来的users是"+users);
        return users;
    }
}
